package com.example.shardingjdbc521.contorller;

import com.example.shardingjdbc521.domain.TOrder;
import com.example.shardingjdbc521.service.TOrderService;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gearace
 */
@Data
@RestController
@RequestMapping("/")
public class IndexController {

    private final TOrderService tOrderService;

    @GetMapping("index")
    public String IndexController() {
        TOrder tOrder = new TOrder();
        tOrder.setName("hello");
        boolean save = tOrderService.save(tOrder);
        return save ? "hello" : "error";
    }
}
